package com.definity.toolkit.persistence;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Service;

import com.definity.toolkit.domain.Domain;

@Service
public class RepositoryFactoryImpl implements RepositoryFactory {

	@PersistenceContext(name="emf")
	private EntityManager entityManager;
	
	public <D extends Domain<?>> Repository<D> create(Class<D> type) {
		return new RepositoryJPA<D>(entityManager, type);
	}
	
}
